#CROSS_COMPILE   = arm-linux-
CC              = $(CROSS_COMPILE)g++
CXX		= $(CC)
AR              = $(CROSS_COMPILE)ar
STRIP           = $(CROSS_COMPILE)strip

#CFLAGS=-g
#LDFLAGS=-rdynamic
objs    = $(patsubst %.cpp,%.o,$(wildcard *.cpp))
headers = $(wildcard *.h)
srcs    = $(wildcard *.cpp)
targets = nt

.PHONY:all,clean,test
all:$(targets)

$(targets):$(objs)
	$(CXX) $(LDFLAGS) -o $@ $^
	$(STRIP) $(targets)
	$(if $(CROSS_COMPILE),,cp $(targets) /usr/bin/)
	

$(objs):$(srcs) $(headers)
	$(CXX) $(CFLAGS) -c -o $@ $(patsubst %.o,%.cpp,$@)	
	
clean:
	rm -f *.o
	rm -f $(targets)
	rm -rf Debug/* Release/*
	rm -f *.ncb
	rm -f *.user

test:
	make
	./$(targets)

